package com.shengqiang.zhenhuiTransfer.controller;

import com.shengqiang.zhenhuiTransfer.entity.Account;
import com.shengqiang.zhenhuiTransfer.entity.AssAcountParams;
import com.shengqiang.zhenhuiTransfer.entity.Result;
import com.shengqiang.zhenhuiTransfer.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @RequestMapping(value = "register")
    public Result<String> register(@RequestBody AssAcountParams params){
        return accountService.associatedAccount(params);
    }

    @RequestMapping(value = "login")
    public Result<Account> login(@RequestBody String jsCode){
        return accountService.login(jsCode);
    }

    @RequestMapping(value = "queryAllAccounts")
    public Result<List<Account>> queryAllAccounts(){
        return accountService.queryAllAccounts();
    }
}
